Type-Directed Continuation Allocation
نویسندگان
چکیده
Suppose we translate two different source languages, L1 and L2, into the same intermediate language; can they safely interoperate in the same address space and under the same runtime system? If L1 supports first-class continuations (call/cc) and L2 does not, can L2 programs call arbitrary L1 functions? Would the fact of possibly calling L1 impose restrictions on the implementation strategy of L2? Can we compile L1 functions that do not invoke call/cc using more efficient techniques borrowed from the L2 implementation? Our view is that the implementation of a common intermediate language ought to support the so-called pay-as-you-go efficiency: first-order monomorphic functions should be compiled as efficiently as in C and assembly languages, even though they may be passed to arbitrary polymorphic functions that support advanced control primitives (e.g. call/cc). In this paper, we present a typed intermediate language with effect and resource annotations, ensuring the safety of inter-language calls while allowing the compiler to choose continuation allocation strategies.
منابع مشابه
Memoization in Type-Directed Partial Evaluation
We use a code generator—type-directed partial evaluation— to verify conversions between isomorphic types, or more precisely to verify that a composite function is the identity function at some complicated type. A typed functional language such as ML provides a natural support to express the functions and type-directed partial evaluation provides a convenient setting to obtain the normal form of...
متن کاملPragmatics of Type-Directed Partial Evaluation
Type directed partial evaluation stems from the residualiz ation of arbitrary static values in dynamic contexts given their type Its algorithm coincides with the one for coercing a subtype value into a supertype value which itself coincides with the one of normalization in the calculus Type directed partial evaluation is thus used to specialize compiled closed programs given their type Since Si...
متن کاملStack-Based Typed Assembly Language
In previous work, we presented a Typed Assembly Language (TAL). TAL is sufficiently expressive to serve as a target language for compilers of high-level languages such as ML. This work assumed such a compiler would perform a continuation-passing style transform and eliminate the control stack by heap-allocating activation records. However, most compilers are based on stack allocation. This pape...
متن کاملType Directed Partial Evaluation for Level-1 Shift and Reset
We present an implementation in the Coq proof assistant of type directed partial evaluation (TDPE) algorithms for call-by-name and call-by-value versions of shift and reset delimited control operators, and in presence of strong sum types. We prove that the algorithm transforms well-typed programs to ones in normal form. These normal forms can not always be arrived at using the so far known equa...
متن کاملGarbage Collection is Fast, But a Stack is Faster
Prompted by claims that garbage collection can outperform stack allocation when sufficient physical memory is available, we present a careful analysis and set of cross-architecture measurements comparing these two approaches for the implementation of continuation (procedure call) frames. When the frames are allocated on a heap they require additional space, increase the amount of data transferr...
متن کامل